<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center kc_flex_0_higd"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub kc_fd0_0_higd'>
					<view class='flex flex-wrap align-center kc_fd0_0_c0_higd' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  kc_fd0_0_c0_c0_higd'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='kc_fd0_0_c1_c0_higd'>{{$t('课程中心')}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end kc_fd0_0_c0_higd'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center">
				<view>
					<benben-flex-tabs class-name='kc_benbenTabsfd1_0_higd' v-model="tabs" ref="benben_tabsfd1_0"
						select-mark="benben_tabsfd1_0" key="benben_tabsfd1_0" :open-title-type='false'
						:open-sticky='true' :top='0' :is-show-content='false' :scrollspy='false'
						:tabs-info.sync="tabsInfofd1_0" @change="tabsChangesFunc($event)">

						<scroll-view @scroll="tabsInfofd1_0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0"
							class="benben-tabs" style="width:750rpx" :scroll-x="true" :scroll-left="tabsInfofd1_0.moveX"
							scroll-with-animation="all .3s ease" :show-scrollbar='false' :enhanced="true">
							<view class="benben-tabs-content" id="benben_tabsfd1_0-content">
								<view id="benben_tabsfd1_0-title"
									class="benben-tabs-title flex flex align-center justify-around">
									<template v-for='(item,key0) in course'>
										<view :key='key0'
											:class="{ 'checkTitlefd1_0_higd': tabs == item.aid, 'flex flex-wrap align-center kc_titlefd1_0_c3_higd': true }"
											@tap="tabs = item.aid" :id="`benben_tabsfd1_0-title-item-${item.aid}`">

											<text>{{item.cate_name}}</text>

										</view>
									</template>
								</view>
								<view :style="{ left: tabsInfofd1_0.lineleft, maxWidth: tabsInfofd1_0.lineWidth ,}"
									id="benben_tabsfd1_0-line"
									class="benben-tabs-line flex benben-flex-tabs-line kc_linefd1_0_higd"
									:class="{'benben-tabs-line-active':tabsInfofd1_0.isInit}"></view>
							</view>
						</scroll-view>

					</benben-flex-tabs>

				</view>
			</view>
			
			<!---flex布局flex布局结束-->
			<!---flex布局flex布局开始-->
			<view class="flex flex-wrap align-center justify-between benben-flex-layout kc_flex_2_higd">
				<view class="flex  flex flex-wrap align-center rfjs_flex_1_higd"
					>
					<view class='flex flex-wrap align-center flex-sub rfjs_fd1_0_higd'>
						<image class='rfjs_fd1_0_c0_higd' mode="aspectFit" :src='STATIC_URL+"134.png"'></image>
						<benben-input class='flex-sub rfjs_fd1_0_c1_higd' type="text" :placeholder="$t('请输入搜索内容')"
							confirm-type="search" :maxlength="-1"
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"
							@confirm="getuv47eac5a55c0bFunc()" v-model="key" />
					</view>
				
				</view>
				<template v-for='(item,key0) in typeList'>
					<view class='flex flex-wrap align-center kc_fd2_0_higd' @tap.stop="handleJumpDiy"
						data-type="navigateTo"
						:data-url="`/pageschool/school/xuexiye/xuexiye?type=2&course_id=${item.aid}&name=${item.name}`"
						:key='key0'>
						<image class='kc_fd2_0_c0_higd' mode="aspectFill" :src='item.thumb'></image>
						<view class='flex flex-direction flex-wrap align-stretch justify-between kc_fd2_0_c1_higd'>
							<text class='kc_fd2_0_c1_c0_higd'>{{item.name}}</text>
							<view class='flex flex-wrap align-center kc_fd2_0_c1_c1_higd'>
								<text>{{$t('共')}}{{item.chapter_num}}{{$t('章节')}}</text>
								<text class='kc_fd2_0_c1_c1_c3_higd'>{{item.study_num}}{{$t('人学习')}}</text>
							</view>
						</view>
					</view>
				</template>
				<view class="public-page-empty " v-if="typeList.length==0">
				  <slot>
				    <image :src="benbenImageSrcResolution('order.png', 'global')"></image>
				    <view class="txt"></view>
				  </slot>
				</view>

			</view>

			<!---flex布局flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"tabsInfofd1_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0,
					isInit: false
				},
				/** course【课程分类】 **/
				"course": [],
				/** typeList【分类列表】 **/
				"typeList": [],
				"creaed": "",
				"tabs": "",
				key:''
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.getqa47eab99d93f6Func()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.getuv47eac5a55c0bFunc()
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//查询课程分类
			async getqa47eab99d93f6Func() {
				//请求方法
				//数据验证

				let datacourse = await this.$api.get(global.apiUrls.post647eab99d93f6, {

				});

				if (datacourse.data.code != 1) {
					this.$message.info(datacourse.data.msg);
					return
				}
				let infocourse = datacourse.data;
				this.course = infocourse.data

				this.tabs = this.course[0].aid

				this.getuv47eac5a55c0bFunc()
			},
			//tabs改变
			tabsChangesFunc(val) {
				console.log("val=>", val)
				this.tabs=val
				this.getuv47eac5a55c0bFunc()
			},
			//查询课程列表
			async getuv47eac5a55c0bFunc() {
				//请求方法
				//数据验证

				let datatypeList = await this.$api.get(global.apiUrls.post647eac5a55c0b, {
					coursecate_id: this.tabs,
					keyword:this.key,
				});

				if (datatypeList.data.code != 1) {
					this.$message.info(datatypeList.data.msg);
					return
				}
				let infotypeList = datatypeList.data;
				this.typeList = infotypeList.data

			},
			search(){
				
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F6F6F6;
		background-size: 100% auto;

		.kc_flex_2_higd {
			margin: 0rpx 32rpx 32rpx 10rpx;

			.kc_fd2_0_higd {
				width: 332rpx;
				height: 288rpx;
				border-radius: 16rpx;
				margin: 0rpx 0rpx 24rpx 22rpx;
				background: rgba(255, 255, 255, 1);
				background-size: 100% auto;

				.kc_fd2_0_c0_higd {
					width: 332rpx;
					height: 160rpx;
					border-radius: 16rpx 16rpx 0rpx 0rpx;
				}

				.kc_fd2_0_c1_higd {
					width: 100%;
					height: 128rpx;
					padding: 16rpx;

					.kc_fd2_0_c1_c0_higd {
						color: rgba(51, 51, 51, 1);
						font-weight: 500;
						line-height: 40rpx;
						-webkit-line-clamp: 1;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-box-orient: vertical;
					}

					.kc_fd2_0_c1_c1_higd {
						width: 100%;
						height: 40rpx;
						color: rgba(153, 153, 153, 1);

						.kc_fd2_0_c1_c1_c3_higd {
							margin: 0rpx 0rpx 0rpx 32rpx;
						}

						.kc_fd2_0_c1_c1_c4_higd {
							margin: 0rpx 0rpx 0rpx 0rpx;
						}
					}
				}
			}
		}

		.checkTitlefd1_0_higd {
			font-weight: 700 !important;
			font-size: 28rpx !important;
			color: #333 !important;
			background-color: #F6F6F6 !important;
		}

		.kc_linefd1_0_higd {
			width: 30rpx;
			height: 8rpx;
			top: 80rpx;
			background: #d53215;
			background-size: 100% auto !important;
		}

		.kc_titlefd1_0_c3_higd {
			padding: 0rpx 0rpx 0rpx 0rpx;
			margin: 0rpx 20rpx 0rpx 20rpx;
		}

		.kc_flex_0_higd {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;

			.kc_fd0_0_higd {
				padding: 0rpx 32rpx 0rpx 32rpx;

				.kc_fd0_0_c1_c0_higd {
					font-size: 36rpx;
					font-weight: 700;
					color: #333333;
					line-height: 50rpx;
				}
			}
		}

		.kc_fd0_0_c0_higd {
			width: 120rpx;

			.kc_fd0_0_c0_c0_higd {
				font-size: 36rpx;
				color: #333;
			}
		}
	}

	::v-deep .kc_benbenTabsfd1_0_higd {
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		background: #f6f6f6;
		text-align: center;
	}
	.rfjs_flex_1_higd {
		width: 750rpx;
		height: 120rpx;
		overflow: hidden;
		z-index: 10;
		// top: 180rpx;
	
		.rfjs_fd1_0_higd {
			margin: 0rpx 32rpx 0rpx 32rpx;
			height: 72rpx;
			border-radius: 36rpx;
			background: #ffffff;
			padding: 0rpx 32rpx 0rpx 32rpx;
			line-height: 72rpx;
	
			.rfjs_fd1_0_c0_higd {
				width: 32rpx;
				height: 32rpx;
				border-radius: 0rpx 0rpx 0rpx 0rpx;
				margin: 0rpx 24rpx 0rpx 0rpx;
			}
	
			.rfjs_fd1_0_c1_higd {
				font-size: 28rpx;
				font-weight: 500;
				color: #333;
				height: 72rpx;
				line-height: 72rpx;
			}
		}
	}
	.public-page-empty {
		width: 100%;
		text-align: center;
	  display: flex;
	  justify-content: center;
	  flex-direction: column;
	  align-items: center;
	  padding: 120upx 0 0 0;
	  image {
	    width: 300rpx;
	    height: 300rpx;
	  }
	  .txt {
	    font-size: 28upx;
	    color: $uni-text-color;
	    text-align: center;
	    line-height: 100upx;
	  }
	}
</style>
